<%@ include file="/WEB-INF/view/include.jsp"%>
<script type="text/javascript" src="resources/js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="resources/js/ui/jquery-ui-1.8.17.custom.min.js"></script>
<script type="text/javascript" src="resources/js/fancybox/jquery.fancybox.pack.js"></script>
<script type="text/javascript" src="resources/js/jquery.pngFix.js"></script>
<script type="text/javascript" src="resources/js/jquery.url.js"></script>
<script type="text/javascript" src="resources/js/jquery.alerts.js"></script>
<script type="text/javascript" src="resources/js/jquery.cookie.js"></script>
<script src="resources/js/ui/jquery.ui.core.js" type="text/javascript"></script>
<script src="resources/js/ui/jquery.ui.widget.js" type="text/javascript"></script>
<!-- <script src="resources/js/ui/jquery.tools.min.js"></script> -->

<script src="resources/js/ui/jquery.ui.datepicker.js" type="text/javascript"></script>
<c:choose>
	<c:when	test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
		<script src="resources/js/ui/jquery.ui.datepicker-ar.js" type="text/javascript"></script>	
	</c:when>
</c:choose>

<script src="resources/js/ui/jquery.ui.selectmenu.js" type="text/javascript"></script>
<script src="resources/js/customScripts/generic.js" type="text/javascript"></script>
<script src="resources/js/date.js" type="text/javascript"></script>

<script type="text/javascript" src="resources/js/validation/jquery.validate.min.js" charset="utf-8"></script>
<script type="text/javascript"
	src="resources/js/validation/localization/<spring:message code="page.js.validation"/>"></script>

<script src="resources/js/jqgrid/grid.base.js" type="text/javascript"></script>
<script src="resources/js/jqgriddata.js" type="text/javascript"></script>
<script src="resources/js/jqgrid/grid.locale-en.js" type="text/javascript"></script>
<script src="resources/js/jqgrid/grid.base.js" type="text/javascript"></script>
<script charset="utf-8" type="text/javascript" src="resources/js/jquery.alerts.js"></script>
<!-- <script type="text/javascript" src="resources/js/jquery.bgiframe.min.js"></script> -->

<script type="text/javascript" src="resources/js/ui/jquery.ui.accordion.js"></script>
<link rel="stylesheet" type="text/css" href="resources/styles/<spring:message code="page.css"/>" />


<!--[if IE 6]>
	<script type="text/javascript" src="resources/js/cusel-min-2.5.js"></script>
	<link rel="stylesheet" type="text/css" href="resources/styles/cusel.css" />
	<script type="text/javascript">
	var params = {
	        changedEl: "select",
	        exclude : ".not_cu_sel",
        visRows: 5,
        scrollArrows: true
    }
    
	jQuery(document).ready(function(){
	$(document).pngFix({resourcesPath : "${pageContext.request.contextPath}"});
	cuSel(params);
	jQuery(".cusel").each(
	function(){
	    var w = parseInt(jQuery(this).width()),
	        scrollPanel = jQuery(this).find(".cusel-scroll-pane");
	    if(w>=scrollPanel.width())
	    {
	        jQuery(this).find(".jScrollPaneContainer").width(w);
	        scrollPanel.width(w);
	    }
	});
	});
		</script>
<![endif]-->

<script>
	
	function changeLanguage(lang){
		var currentURL = $.url();
		var urlStr = currentURL.attr('source');
		var currentLang = currentURL.param('lang');
		var selectedLangName = lang;
		if (!$.isEmptyObject(currentURL.param())) {
				if (typeof currentLang == "undefined" || currentLang == null) {
						urlStr += "&lang="+ selectedLangName;
				} else {
						var re = new RegExp("lang=([a-z]{2})", "g");
						urlStr = urlStr.replace(re, "lang="+ selectedLangName);
				}
		} else {
			urlStr += "?lang=" + selectedLangName;
		}

		window.location.replace(urlStr);
	}
	
	$(document).ready(function(){
		var monthNames = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ]; 
		var dayNames= ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];

		var newDate = new Date();
		// Extract the current date from Date object
		newDate.setDate(newDate.getDate());

		$('#Date').html(dayNames[newDate.getDay()] + ", " + newDate.getDate() + ' ' + monthNames[newDate.getMonth()] + ', ' + newDate.getFullYear());

		
		setInterval( function() {
				// Create a newDate() object and extract the minutes of the current time on the visitor's
				var minutes = new Date().getMinutes();
				// Add a leading zero to the minutes value
				$("#min").html(( minutes < 10 ? "0" : "" ) + minutes);
		    },1000);
		
		setInterval( function() {
			// Create a newDate() object and extract the hours of the current time on the visitor's
			var hours = new Date().getHours();
			if (hours == 0){
				hours = 12 ;
				$("#ampm").html(" AM");
			}else if(hours > 12){
				hours = hours - 12 ;
				$("#ampm").html(" PM");
			}else if(hours < 12){
				$("#ampm").html(" AM");
			}
			// Add a leading zero to the hours value
			$("#hours").html(( hours < 10 ? "0" : "" ) + hours);
	   	 }, 1000);	

		$("#englishDiv").click(function (){
				
		
		});
		
		
		$("a[rel=attachments_group]").fancybox({
	    	 helpers : {
	    		title : {
	    			type : 'over'
	    		}
	    	},
	    	autoSize: false,
	    	loop: false,
	    	fitToView: false
	    });
		$(".pdfimageattachment").fancybox({
			/*  	 'width' : '500',
			   'height' : '500',
			   'autoScale' : true, */ 
				 helpers : {
			    		title : {
			    			type : 'over'
			    		}
			    },
			    autoSize: false,
			    loop: false,
			    fitToView: false, 
			   'transitionIn' : 'none',
			   'transitionOut' : 'none',
			   'type' : 'iframe'
	    	 
	    	
	    });
	});
	
	function textLimit(field,maxlen){
		if(field.value.length > maxlen){
			field.value = field.value.substring(0,maxlen);
		}
	}
	
	function formatDate(input){
		var datePart = input.match(/\d+/g);
		var year = datePart[2];
		var month = datePart[1];
		var day = datePart[0];
		
		return (month + '/' + day +'/'+ year) ;
	}
	
	function closeApplication(){
		fancyConfirm('<spring:message code="message.close_confirmation_message" />'
				,'<spring:message code="button.No" />'
				,'<spring:message code="button.yes" />'
				, function(ret) {
					if(ret == true){
						window.location='${pageContext.request.scheme}://${pageContext.request.serverName}:${pageContext.request.serverPort}${pageContext.request.contextPath}/client/company/home/show.htm';
					}
		});
	}
</script>

<link rel="stylesheet" type="text/css" href="resources/styles/base/jquery.ui.all.css" />
<link rel="stylesheet" type="text/css" href="resources/styles/base/jquery.ui.selectmenu.css" />
<link rel="stylesheet" type="text/css" href="resources/styles/jq.grid.styles.css" />
<link rel="stylesheet" type="text/css" href="resources/styles/jquery-ui-1.8.2.custom.css" >
<link rel="stylesheet" type="text/css" href="resources/styles/jquery.alerts.css" />
<link rel="stylesheet" type="text/css" href="resources/js/fancybox/jquery.fancybox.css" />
<link rel="stylesheet" type=text/css href="resources/styles/jquery.alerts.css" />

<link rel="stylesheet" type="text/css" href="resources/styles/<spring:message code="page.css"/>" />

<tiles:useAttribute id="list" name="jsfilesList" classname="java.util.List" />
<c:forEach var="jsfileName" items="${list}">
    <script type="text/javascript" src="<%=request.getContextPath()%>/<c:out value='${jsfileName}' />"></script>
</c:forEach>

<tiles:useAttribute id="list" name="cssfilesList" classname="java.util.List" />
<c:forEach var="jsfileName" items="${list}">
    <script src="<%=request.getContextPath()%>/<c:out value='${jsfileName}' />"></script>
</c:forEach>